<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="renderer" content="webkit">
  	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  	<meta name="apple-mobile-web-app-status-bar-style" content="black"> 
  	<meta name="apple-mobile-web-app-capable" content="yes">
  	<meta name="format-detection" content="telephone=no">
	<title>登陆 - <<<.Configs.SiteTitle>>></title>
	<link rel="stylesheet" href="/static/blog/layui/css/layui.css">
	<link rel="stylesheet" href="/static/blog/css/common.css">
	<link rel="stylesheet" href="/static/blog/css/login.css">
</head>
<body>
	<div class="layui-container">
		<div class="layui-row">
			<div class="layui-col-md12 layui-hide-xs xs-hide"></div>
			<div class="layui-col-md4 layui-col-md-offset4 login-main">
				<img src="/static/blog/images/logo.png" class="logo">
				<div class="main formbox">
					<form action="javascript:void(0);" accept-charset="utf-8" class="layui-form">
						<div class="inputbox">
							<input type="text" name="username" required  lay-verify="required" placeholder="请输入邮箱账号" autocomplete="off" class="layui-input">
						</div>
					    
					    <div class="margin20"></div>
						<div class="inputbox">
					    	<input type="password" name="password" required  lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
						</div>

					    <div class="margin20"></div>
						<div class="inputbox">
					    	<input type="text" name="captcha" required  lay-verify="required" placeholder="请输入验证码" autocomplete="off" class="layui-input">
							<<< create_captcha >>>
					    	<i class="l"></i>
						</div>
						<div class="margin20"></div>

					    <div class="layui-row layui-col-space20 bts">
					    	<div class="layui-col-md12">
					    		<button type="submit" class="layui-btn" lay-submit lay-filter="submit">登陆</button>
					    	</div>
							<div class="layui-col-md12">
								<a href="javascript:;" class="layui-btn layui-btn-primary">返回首页</a>
							</div>
					    </div>
					</form>
				</div>
			</div>
		</div>
	</div>

</body>
<script src="/static/blog/layui/layui.js"></script>
<script>
	layui.use(["form", "jquery"], function () {
		let form = layui.form,
				$ = layui.jquery;
		form.on('submit(submit)', function(data){
			$.ajax({
				url: '/api/login',
				type: 'post',
				data: JSON.stringify(data.field),
				dataType: "json",
				contentType: 'application/json',
				success: function (response) {
					if (response.code === 1) {
						layer.alert(response.msg);
					} else {
						location.href = "/"
					}
				}
			});
			return false;
		});
	});

</script>
</html>